const { classesModel } = require('../models/classesModel')

async function addClasses(req, res) {
    const result = classesModel.create(req.body);
    if (result) {
        res.send({
            message: '班级新增成功',
            code: 1
        })
    } else {
        res.send({
            message: '班级新增失败',
            code: 0
        })
    }
}

async function getClasses(req, res) {
    const data = await classesModel.find();
    res.send({
        message: '班级数据获取成功',
        code: 1,
        data
    })
}

module.exports = {
    addClasses, getClasses
}